package com.speedy.course.ui

import android.os.Bundle
import androidx.navigation.findNavController
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.speedy.course.R
import com.speedy.course.base.BaseActivity
import com.speedy.course.databinding.ActivityMainBinding
import com.speedy.course.ext.navPager

class MainActivity : BaseActivity() {


    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val navView: BottomNavigationView = binding.navView

        navView.setOnItemSelectedListener {
            when(it.itemId){
                R.id.navigation_home->navPager(R.id.navigation_home)
                R.id.navigation_task->navPager(R.id.navigation_task)
                R.id.navigation_mine->navPager(R.id.navigation_mine)
            }
            return@setOnItemSelectedListener true
        }


        navView.apply {
            itemIconTintList = null
        }
    }
}

